﻿/** 
 * Description:购物车信息DAO
 * Date:2011-7-16
 * Author:Along	
*/
package com.community.shopping.dao;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.community.shopping.domain.ShoppingCart;

public class ShoppingCartDao extends HibernateDaoSupport{
	private Log log = LogFactory.getLog(ShoppingCartDao.class);  
	

	public void save(ShoppingCart shoppingCart){
		getHibernateTemplate().saveOrUpdate(shoppingCart);	
		log.debug("-------保存一行shoppingCart-------");
	}

	public void delete(ShoppingCart shoppingCart){		  
		getHibernateTemplate().delete(shoppingCart);
		log.debug("---------删除一行shoppingCart-------");
	}


	public List<?> getShoppingCart() {  		
	 return getHibernateTemplate().find(" from ShoppingCart"); 
	 }

	public List<?> getShoppingCart(String sql){
		String finalsql="from ShoppingCart where "+sql;
		return getHibernateTemplate().find(finalsql);
	}   
	}
